//
//  CAttentionDataView.h
//  HCHK_iphone
//
//  Created by yilong zhang on 12-4-25.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CCondition.h"
#import <QuartzCore/QuartzCore.h>
#import "CUser.h"
#import "CRootCtrlManager.h"
#import "CDownLoadManager.h"

@class CAttentionCell;

@protocol CitySelectorProtocal;

//==============================================================================================================================

@interface CPeople : NSObject <OperationDelegate>

@property (nonatomic, assign) long      m_ID;
@property (nonatomic, retain) NSString  *m_Nick;
@property (nonatomic, retain) NSString  *m_Name;
@property (nonatomic, retain) NSString  *m_Icon;
@property (nonatomic, assign) NSData    *m_Data;
@property (nonatomic, retain) CTask     *m_IconTask;
@property (nonatomic, assign) BOOL      m_IsLoad;
@property (nonatomic, retain) NSString  *m_Email;
@property (nonatomic, retain) NSString  *m_City;
@property (nonatomic, assign) int       m_nType;
@property (nonatomic, assign) long      m_lFollowID;
@property (nonatomic, retain) NSString  *m_Date;
@property (nonatomic, assign) int       m_nFrdNum;
@property (nonatomic, assign) int       m_nComNum;
@property (nonatomic, assign) int       m_nPubNum;
@property (nonatomic, assign) int       m_nState;       //1已经关注，0未关注

-(void)SetValueWithDic:(NSDictionary*)dic;
-(NSData*)GetIcon;
-(void)DownLoadIcon;

@end

//==============================================================================================================================

@interface CAddress : NSObject

@property (nonatomic, retain) NSString  *m_Addr;
@property (nonatomic, retain) NSString  *m_Date;
@property (nonatomic, assign) long      m_lFollowid;
@property (nonatomic, assign) int       m_nType;
@property (nonatomic, assign) long      m_LID;
@property (nonatomic, assign) float     m_fLat;
@property (nonatomic, assign) float     m_fLog;
@property (nonatomic, assign) int       m_nState;       //1已经关注，0未关注

-(void)SetValueWithDic:(NSDictionary*)dic;

@end

//==============================================================================================================================

@protocol AttentionCellDelegate <NSObject>

@optional
-(void)DidAttentionCellButtonClicked:(UIButton*)sender Cell:(CAttentionCell*)cell;

@end


//==============================================================================================================================

@interface CAttentionCell : UITableViewCell

@property (nonatomic, assign) id<AttentionCellDelegate> delegate;

@property (nonatomic, retain)  UIButton *m_EditBtn;
@property (nonatomic, assign)  id       m_Data;
@property (nonatomic, assign)  BOOL     m_IsValue;

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier Size:(CGSize)size;
-(void)OnButtonDown:(UIButton*)sender;

@end

//==============================================================================================================================

@interface CAttentionDataView : UIView <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource, OperationDelegate, AttentionCellDelegate, CitySelectorProtocal>

@property (nonatomic, assign) UISearchBar   *m_SearchBar;
@property (nonatomic, assign) UIScrollView  *m_Scroll;
@property (nonatomic, assign) UITableView   *m_TableView;
@property (nonatomic, assign) CAttentionCell*m_Cell;
@property (nonatomic, assign) UIView        *m_FootView;
@property (nonatomic, assign) long          m_lUserID;
@property (nonatomic, assign) NSMutableArray*m_Data;
@property (nonatomic, assign) int           m_nOpType;
@property (nonatomic, retain) CTask         *m_Task;
@property (nonatomic, retain) CTask         *m_SearchTask;
@property (nonatomic, assign) CAscCounter   *m_NetCnt;
@property (nonatomic, assign) CAscCounter   *m_SearCnt;

@property (nonatomic, assign) UIView    *m_LoadView;
@property (nonatomic, assign) BOOL      m_IsLoading;
@property (nonatomic, assign) BOOL      m_IsPageEnd;

@property (nonatomic, assign) UILabel   *m_NoData;
@property (nonatomic, retain) CAddrInfo *m_AddInfo;

//loadview
-(void)SetUpLoadView;
-(void)ShowLoadView;
-(void)HiddenLoadView;

//footview
-(void)ShowFootView;
-(void)HiddenFootView;

-(void)SetAttentionDatas:(int)index;
-(void)GetDatas:(int)index;
-(void)ClearDatas;

//add datas
-(void)AddPeople:(NSArray*)datas;
-(void)AddFood:(NSArray*)datas;
-(void)AddAddress:(NSArray*)datas;

//cancel attention
-(void)CancelAttention:(id)value Cell:(CAttentionCell*)cell;
-(void)CommitCancelAttention:(id)value;
-(void)ReceiveCancelAttentionResponse:(NSDictionary*)data;

//search
-(int)SearchPeople:(NSString*)value;
-(int)SearchAddress:(NSString*)value;
-(int)SearchFood:(NSString*)value;
-(void)ShowMap;
-(void)HiddenMap;
-(void)CommitAllSearch:(int)index Value:(id)value;
-(void)ReceiveAllSearchReponse:(NSDictionary*)data Index:(int)index;

-(void)CommitGetPeopleRequest;
-(void)ReceivePeopleReponse:(NSDictionary*)data;
-(void)CommitGetFoodRequest;
-(void)ReceiveFoodResponse:(NSDictionary*)data;
-(void)CommitGetAddressRequest;
-(void)ReceiveAddressResponse:(NSDictionary*)data;
-(void)CommitFoodsInAddressRequest:(CAddress*)addr;
-(void)ReceiveFoodsInAddressResponse:(NSDictionary*)data;

@end
